<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>添加管理员</title>
	
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
   	<script type="text/javascript" src="@{'/public/javascripts/jquery-1.6.4.min.js'}"></script>
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
	<link type="text/css" rel="stylesheet" href="@{'/public/indexFile/css/public.css'}" charset="utf-8"/>
	<link type="text/css" rel="stylesheet" href="@{'/public/indexFile/css/index.css'}" charset="utf-8"/>
	<link rel="stylesheet" href="/public/stylesheets/alert.css" type="text/css" />
	<script type="text/javascript" src="/public/javascripts/adu.alert.js"></script>
	
  </head>
  
  <style type="text/css">
		.code{
		background-image:url(code.jpg);
		font-family:Arial;
		font-style:italic;
		color:Red;
		border:0;
		padding:2px 3px;
		letter-spacing:3px;
		font-weight:bolder;
		}
		.unchanged {
		border:0;
		}
	</style>
    <body>
    <!-- content 开始-->
    <div class="cont">
    	<div class="mem2_b">
        	<div class="m2_b_a">
            	<span style="cursor: pointer;font-size:16px;" id="preg">添加管理员</span>
            </div>
            <div class="m2_b_c">
	            <div class="m2_b_c1">
	               	<div class="m2c_a">角色类型：</div>
	                   <div class="">
		                   <select id="roletype" style="width:100px;">
		                  	 #{list items:rolelist, as:'role'}
		                  	 	<option value="${role?.id}">${role?.rolename}</option>
		                  	  #{/list}
		                   </select>
	                   </div>
                </div>
            	<div class="m2_b_c1">
                	<div class="m2c_a">用户名：</div>
                    <div class="m2c_b"><input id="uname" type="text"/></div>
                    <div class="m2c_c"><label id="span_one">请输入您的用户名！</label><label style="display:none;" id="span_two">请您输入正确的邮箱格式！</label><label style="display:none;color:red;" id="span_three">邮箱不能为空！</label><label style="display:none;color:red;" id="span_four">邮箱已经被注册！</label></div>
                </div>
                <div class="m2_b_c1">
                	<div class="m2c_a">密码：</div>
                    <div class="m2c_b"><input id="password" type="password"/></div>
                    <div class="m2c_c"><label id="span_pone">请输入您的密码！</label><label style="display:none;" id="span_ptwo">6-16位字符，可由中文、英文、数字及'_'组成</label><label style="display:none;color:red;" id="span_pthree">密码不能为空！</label></div>
                </div>
                <div class="m2_b_c1">
                	<div class="m2c_a">真实姓名：</div>
                    <div class="m2c_b"><input id="relname" type="text"/></div>
                    <div class="m2c_c"><label id="span_rpone">请再输入您的真实姓名！</label><label style="display:none;" id="span_rptwo">6-16位字符，可由中文、英文、数字及'_'组成</label><label style="display:none;color:red;" id="span_rpthree">两次密码不一样，请您重新输入！</label></div>
                </div>
                <div class="m2_b_c1">
                	<div class="m2c_a">状态：</div>
                    <div class="">
                    	<select id="state" style="width:100px;">
                    		<option value = "0">正常</option>
                    		<option value = "1">禁用</option>
                    		<option value = "2">回收</option>
                    	</select>
                    </div>
                </div>
                 <div class="m2_b_c1">
                	<div class="m2c_a">权限：</div>
                    <div class="">
                    	#{list items:permislist, as:'permis'}
                    		<span><input type="checkbox" value="${permis?.percode}" />${permis?.pername}</span>
                    	#{/list	}
                    </div>
                </div>
                <div class="m2_b_c4"><input id="subtt" type="button" value="提交" /><a style="margin-left:180px;" href="/controllers/Managers.list">返回</a></div>
            </div>
        </div>
        <script type="text/javascript">
        	$("#subtt").click(function(){
        		var param = $("input[type='checkbox']:checked");
        		
	        	var str = "roletype=" + $("#roletype").val()+"&uname="+$("#uname").val()+"&password="+$("#password").val()+ "&relname="+$("#relname").val()+"&state="+$("#state").val();
        		for(var i = 0 ; i < param.length ; i++){
        			str += "&permis="+param[i].value;
        		}
        		
        		$.ajax({
        			type:'post',
        			url :'/controllers/Managers.savemanngers',
        			data:str,
        			dataType:'html',
        			success:function(e){
        				if(e == "1"){
        					aduAlert("添加成功！","提示",function(){
        						window.location.href = "/controllers/Managers.list";
        					});
        				}
        				if(e == "0"){
        					aduAlert("添加失败！","提示");
        				}
        			}
        		});
        	});
        </script>
    </div>
    <!-- content 结束-->
  </body>
</html>
